#include <bits/stdc++.h>

using namespace std;
#define ll long long

long long n;

int main (){
	cin>>n;
	ll m = 2*(n)+2;
	ll x = sqrt(n);
	while(x * (x+1) > m)x--;
	while(x * (x+1) <= m) x++;
	n -= x-1;
	cout<<n+1;
}
